<!--
 * @Description:
 * @Author: zhaolei
 * @Date: 2023-04-13 11:00:21
-->
<template>
  <avue-form
    ref="addForm"
    v-model="form"
    :option="tableOption"
  >
  </avue-form>
</template>

<script>
import { getAdoptRecordById } from '@/api/core/adopt';
export default {
  name: 'adoptionTab',
  props: {
    id: {
      type: [Object, String],
    },
  },
  data() {
    return {
      form: {},
      tableOption: {
        ...window.$crudMixins.tableOptions,
        addBtn: false,
        editBtn: false,
        delBtn: false,
        menuWidth: 260,
        labelWidth: 140,
        emptyBtn: false,
        submitBtn: false,
        detail: true,
        group: [
          {
            label: '领养人信息',
            prop: 'group2',
            column: [
              {
                label: '领养人姓名',
                prop: 'adoptName',
              },
              {
                label: '领养人手机号',
                prop: 'phone',
              },
              {
                label: '领养人编号',
                prop: 'userId',
              },
              {
                label: '领养人昵称',
                prop: 'nickName',
              },
              {
                label: '微信昵称',
                prop: 'wxNickName',
              },
              {
                label: '领养日期',
                prop: 'adoptDate',
                type: 'datetime',
                format: 'yyyy-MM-dd HH:mm:ss',
                valueFormat: 'yyyy-MM-dd HH:mm:ss',
                search: true,
                width: 160,
                searchRange: true,
              },
            ],
          },
        ],
      },
    };
  },
  watch: {
    id: {
      immediate: true,
      handler(val) {
        if (val) {
          this.getDetail();
        }
      },
    },
  },
  methods: {
    async getDetail() {
      const res = await getAdoptRecordById(this.id);
      if (!this.validatenull(res.data.data)) {
        this.form = { ...res.data.data };
      }
    },
  },
};
</script>

<style lang='scss' scoped>
</style>
